import Vue from 'vue'
import Element from 'element-ui'
import ElementPersonal from '@ele'
import './style/index.scss'
import './asset/icon'
import './directive'
import App from './App'
import store from './store'
import router from './router'
import filters from './filter'
import globalMethod from './globalMethod'

import websocket from 'vue-native-websocket';
// Vue.use(websocket, 'ws://192.168.33.22:19109/mini-wms/wms')
localStorage.setItem('request_url','https://api.deepb2b.com')

Vue.use(websocket, 'ws://192.168.0.102:19103/mini-wms/wms', {
  format: 'json', // json格式
  reconnection: true, // 是否自动重连
  reconnectionAttempts: Infinity, // 自动重连次数
  reconnectionDelay: 2000, // 重连间隔时间
});



// import fs from 'fs';
import VueResource from 'vue-resource'
Vue.use(VueResource)

Vue.use(Element)
Vue.use(ElementPersonal)
Vue.use(filters)
Vue.use(globalMethod)

// Vue.prototype.$ajaxGET = function (options) {
//   const defaultOptions = {
//     method: 'GET',
//     dataType: 'json',
//     responseType: 'text',
//     headers: {
//       'Content-Type': 'application/json'
//     }
//   };
//   const mergedOptions = Object.assign(defaultOptions, options);
//   return Vue.request(mergedOptions);
// };


Vue.config.productionTip = false

new Vue({
    el: '#app',
    router,
    store,
    render: h => h(App)
})

// 页面刷新时websocket重连
// store.dispatch('websocket/init').catch()
